﻿#ifndef TEST_RECORD_MANAGER_H
#define TEST_RECORD_MANAGER_H

#include <QtCore/QObject>

#include <QVector>
#include "CommonType.h"

namespace zl {


class TestRecordManager : public QObject
{
public:
    static TestRecordManager* getInstance();
    static void Release();

    // 创建默认测试记录
    void GetEmptyRecord(RecordInfo& record);

    // 保存测试记录
    int32_t SaveTestRecord(RecordInfo& record);

    // 删除选中的记录
    int32_t RemoveTestRecords(const QStringList& record_id);

    // 在数据库中查找是否已经存过
    int32_t SearchRecord(const QString& record_id);

    // 在数据库中删除指定记录
    int32_t RemoveRecord(const QString& record_id);

    // 按照条件 查询测试记录信息
    int32_t GetAllRecord(
        RecordVec& vec,
        const QString& begin_time,
        const QString& close_time,
        const ESNWT_ActionType action_type = ESNWT_ActionType_Unknow,
        const ESNWT_ResultType result_type = ESNWT_ResultType_Unknow,
        const QString account = "",
        const QString sn_info = "",
        const EConfirm_Type confirmed = EConfirm_Type_Unknown);

    int32_t GetComboCompleterInfo(QStringList& account_list, QStringList& sn_info_list);

private:   

    TestRecordManager();
    TestRecordManager(const TestRecordManager &);
    TestRecordManager& operator = (const TestRecordManager &);

    ~TestRecordManager();

    QString GeneratedRecordID();
private:
    static TestRecordManager* m_instance;

};

} // namespace end

#endif // TEST_RECORD_MANAGER_H
